

<body class="iframe">
    <div class="edit">
        <div class="frame-header">
            <h2><i class="layui-icon">&#xe705;</i>设置</h2>
        </div>
        <h4 class="layui-bg-dark frame-title"><i class="layui-icon">&#xe65f;</i>个人信息</h4>
        <form class="layui-form" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">用户名</label>
                <div class="layui-input-inline">
                    <input type="text"  value="<?= $userinfo['username'] ?>" class="layui-input" disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">邮箱</label>
                <div class="layui-input-inline">
                    <input type="text"  value="<?= $userinfo['email'] ?>" class="layui-input" disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">新密码</label>
                <div class="layui-input-inline">
                    <input type="text" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">确认密码</label>
                <div class="layui-input-inline">
                    <input type="text" name="repassword" required lay-verify="required" placeholder="请确认密码" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="updateuser">立即提交</button>
                </div>
            </div>
        </form>

    </div>
</body>
<script>
    layui.use(['form', 'layer'], function () {
        var form = layui.form, layer = layui.layer;
        form.on('submit(updateuser)', function (data) {
            let url = '<?= site_url("user/reset_password") ?>';
            let password = data.field.password;
            let repassword = data.field.repassword;
            let jsonData = {
                'password': password,
                'repassword': repassword
            };
            request(url, jsonData, goLogin, layer);
            return false;
        });

    });
    function goLogin() {
        setTimeout(function () {
            window.top.location.href = "<?= site_url('user/login') ?>";
        }, 2000);
    }
</script>

</html>